#-*-coding:utf-8-*-

# 文件操作
path1 = "e:/pythonTest/test.txt"
path2 = "./test.txt"

testNum = 100
# 文件读取
def readFile(path):
	if not path:
		return
	fileData =  open(path,"r",1)
	print fileData.read()
	fileData.close()

# 会直接覆盖前面的内容
def writeFile(path,info):
	if not path:
		return

	fileData = open(path,"w+")
	fileData.write("\n write something here{}\n".format(info))
	fileData.close()

# 追加
def appendInfo(path,info):
	if not path:
		return

	fileData = open(path,"a",1)
	fileData.write("\n write something new here {} \n".format(info))
	fileData.close()

def withAppendInfo(path,info):
	if not path:
		return
	with open(path,"a",1) as fileData:
		fileData.write("\n write something here {} \n ".format(info))


def get_url():
	from urllib import urlopen
	url = "http://www.baidu.com/?tn=80035161_1_d"
	def get_inner():
		res = urlopen(url).read()
		print res
	return get_inner



if __name__ == "__main__":
	# writeFile(path2,"啥也没有")
	# appendInfo(path2,"一会要去开会了")
	# withAppendInfo(path1,"用了path1 {}".format(path1))
	# readFile(path2)
	get = get_url()
	get()
	pass